//
//  struct.hpp
//  learnC++
//
//  Created by apple on 2018/5/24.
//  Copyright © 2018年 yunfan.com. All rights reserved.
//

#ifndef struct_hpp
#define struct_hpp

#include <stdio.h>
#include <iostream>
#include <string>

struct Employee {
    short id;
    int age;
    double wage;
    
    //成员函数指针
    int (*member)();
};

struct Company
{
    Employee CEO; // Employee is a struct within the Company struct
    int numberOfEmployees;
};

//step
typedef struct tagStudentinfo{
    
    int      niD;
    std::string   strName;
    //重载 < 就可以进行排序算法了
    bool operator < (tagStudentinfo const& _A) const
    
    {     //这个函数指定排序策略，按niD排序，如果niD相等的话，按strName排序
        
        if(niD < _A.niD) return true;
        
        if(niD == _A.niD)
            
            return strName.compare(_A.strName) < 0;
        
        return false;
        
    }
    
}Studentinfo, *PStudentinfo; //学生信息


void test_struct();

#endif /* struct_hpp */
